package com.djx.threadstudy.Thread;

/**
 * @ClassName ThreadYieldTest01
 * @Date 2021/7/9 0009 上午 9:39
 * @Author Administrator
 * @Description TODO
 * Version 1.0
 */
public class ThreadYieldTest01 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 2000; i++) {
            String name = Thread.currentThread().getName();
            System.err.println(name+"__runnable__"+i);
                System.err.println(name+"__runnable__"+i);
                System.out.println(name+"__runnable__"+i);
            if (i==1111){
                Thread.yield();
            }
        }
    }
    public static void main(String[] args) {
        ThreadYieldTest01 threadYieldTest01 = new ThreadYieldTest01();
        Thread thread = new Thread(threadYieldTest01, "张三");
        Thread thread1 = new Thread(threadYieldTest01, "---------李四");
        thread1.start();
        thread.start();


    }
}
